import React, { Component } from 'react'
const center = 'center'

// 1. 给按钮绑定点击事件
// 2. 获取原来的数字
// 3. 在原来数字的基础上 +1

export default class App extends Component {
  state = {
    count: 0,
  }
  // ???? this =>
  temp = this
  handleClick = () => {
    // console.log(this) // 实例
    console.log(this.state.count) // 实例
  }
  render() {
    return (
      <div style={{ textAlign: center }}>
        <h2>计数器：{this.state.count}</h2>
        <button onClick={this.handleClick}>+1</button>
      </div>
    )
  }
}

const a = new App()
console.log(a.temp === a, '88') // true
